package com.mentaleye.enums;

import java.util.EnumSet;
import java.util.HashMap;
import java.util.Map;

public enum CommonStatus {
	
	DEFAULT(0, "默认"),NOMAL(1, "正常"), DELETE(2, "删除"),JOB(3,"在职"),QUIT(4,"离职"),ALREADY_USED(5,"已经使用"),
	END_USE(6,"使用结束"),NOT_PAYMENT(7,"未缴费"),HAS_PAYMENT(8,"已缴费"),NOT_CHECKIN(9,"未入住"),
	HAS_CHECK_IN(10,"已入住"),HAS_MOVE_OUT(11,"已搬离"),STAGE_ASSESSMENT(151,"阶段考核"),
	EMPLOYMENT_REMINDER(152,"就业提醒"),CLASS_REMINDER(153,"结课提醒"),APPROVAL_REMINDER(154,"审批提醒"),
	PAYMENT_REMINDER(155,"付款提醒"),WAIT(120,"待填写"),PART_READY(121,"部分提交"),READY(122,"已提交"),END(123,"已结束");

	private CommonStatus(Integer code, String msg) {
		this.msg = msg;
		this.code = code;
	}

	private Integer code;
	private String msg;

	public Integer getCode() {
		return code;
	}

	public void setCode(Integer code) {
		this.code = code;
	}

	public String getMsg() {
		return msg;
	}

	public void setMsg(String msg) {
		this.msg = msg;
	}

	public static Map<Integer, String> enumMap = new HashMap<Integer, String>();
	static {
		for (CommonStatus s : EnumSet.allOf(CommonStatus.class)) {
			enumMap.put(s.getCode(), s.getMsg());
		}
	}

	/**
	 * 根据编码查找枚举
	 */
	public static CommonStatus find(int code) {
		for (CommonStatus frs : CommonStatus.values()) {
			if (frs.getCode().intValue() == code) {
				return frs;
			}
		}
		return null;
	}
}
